package com.cedar.controller;

import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

@Controller
public class TestController {

	@RequestMapping("/test1.htm")
	public String test(){
		return "test/test1";
	}
	
	@RequestMapping("/test2.htm")
	public ModelAndView test1(HttpServletRequest request, HttpServletResponse response) throws Exception {

		return new ModelAndView("jsp/test/test2", "msg", "This is “test2.jsp” with test2");

	}
	
	
	@RequestMapping("{set}/test3")
	public ModelAndView test3(Map<String, Object> map,@PathVariable String set) throws Exception {
		
		return new ModelAndView(set+"/test3", "msg", "This is test3.jsp with test3");
	}
	
	@RequestMapping("{set}/test3/sub")
	public ModelAndView test4(Map<String, Object> map,@PathVariable String set) throws Exception {
		
		return new ModelAndView(set+"/test3", "msg", "This is test3.jsp with sub");
	}
	
	@RequestMapping("{set}/test5/{sub}")
	public ModelAndView test5(Map<String, Object> map,@PathVariable String set,@PathVariable String sub) throws Exception {
		
		return new ModelAndView(set+"/test3", "msg", "This is test3.jsp with "+sub);
	}
}
